package com.zyz.bookborrowing.service;

import com.zyz.bookborrowing.bean.User;
import com.zyz.bookborrowing.dao.IUserDao;
import com.zyz.bookborrowing.dao.UserDaoImpl;

import java.util.List;

public class UserServiceImpl implements IUserService{

    private IUserDao userDao = new UserDaoImpl();

    @Override
    public List<User> getUser(User user) {
        return userDao.list(user);
    }

    @Override
    public Integer addUser(User user) {
        return userDao.save(user);
    }

    @Override
    public Integer deleteById(Integer id) {
        return userDao.deleteById(id);
    }

    @Override
    public User queryById(Integer id) {
        return userDao.queryById(id);
    }

    @Override
    public Integer updateUser(User user) {
        return userDao.updateUser(user);
    }

    @Override
    public String checkUserName(String userName) {
        return userDao.checkUserName(userName);
    }

    @Override
    public User checkUserNP(String username, String password) {
        return userDao.checkUserNP(username, password);
    }

//    public static void main(String[] args) {
//        UserServiceImpl service = new UserServiceImpl();
//        for (User user : service.getUser(null)) {
//            System.out.println(user);
//        }
//    }
}
